<template>
  <div class="detail box">
    <div class="left">
      <div class="info-list">
        <div
          class="info-item"
          v-for="(item, index) in infoList"
          :key="index"
          :class="{ active: position === item }"
          @click="infoItemClick(item, index)"
        >
          {{ item }}
        </div>
      </div>
    </div>
    <div class="right">
      <div v-if="position === '1'">
        <RemindersOne :position="this.position"></RemindersOne>
      </div>
      <div v-if="position === '2'">
        <RemindersTwo :position="this.position"></RemindersTwo>
      </div>
      <div v-if="position === '3'">
        <RemindersThree :position="this.position"></RemindersThree>
      </div>
      <div v-if="position === '4'">
        <RemindersFour :position="this.position"></RemindersFour>
      </div>
      <div v-if="position === '5'">
        <!-- <RemindersFive></RemindersFive> -->
      </div>
    </div>
  </div>
</template>

<script>
import RemindersOne from './components/RemindersOne.vue';
import RemindersTwo from './components/RemindersTwo.vue';
import RemindersThree from './components/RemindersThree.vue';
import RemindersFour from './components/RemindersFour.vue';
// import RemindersFive from "./components/RemindersFive.vue";
import { reminderTypes, reminderQuery } from '@/api/customerList/index.js';
export default {
  name: 'platform',
  components: {
    RemindersOne,
    RemindersTwo,
    RemindersThree,
    RemindersFour,
    // RemindersFive,
  },
  data() {
    return {
      position: '1',
      infoList: [
        // {
        //   label: '走访预约提醒',
        //   value: '1',
        //   isActive: false,
        // },
        // {
        //   label: '客户排名变动提醒',
        //   value: '2',
        //   isActive: false,
        // },
        // {
        //   label: '商机提醒',
        //   value: '3',
        //   isActive: false,
        // },
        // {
        //   label: '授信到期提醒',
        //   value: '4',
        //   isActive: false,
        // },
        // {
        //   label: '自定义提醒',
        //   value: '5',
        //   isActive: false,
        // },
      ],
    };
  },
  watch: {
    $route: {
      immediate: true,
      handler(value) {
        // this.getCurrentActive();
      },
    },
  },
  async mounted() {
    // this.getCurrentActive();
    this.reminderTypesFn();
    this.reminderQueryFn(1);
  },

  methods: {
    // getCurrentActive() {
    //   const path = this.$route.path;
    //   console.log("path", path);
    //   const index = path.split("details/")[1];
    //   if (index === "one") {
    //     this.position = "1";
    //   }
    //   if (index === "two") {
    //     this.position = "2";
    //   }
    //   if (index === "three") {
    //     this.position = "3";
    //   }
    // },
    async reminderTypesFn() {
      const res = await reminderTypes();

      this.infoList = res.data;
    },
    infoItemClick(item, index) {
      this.position = item;
      this.reminderQueryFn(item);
    },
    async reminderQueryFn(index) {
      const res = await reminderQuery({
        pageNum: 1,
        pageSize: 10,
        type: index,
      });
      console.log(res, '777');
    },
  },
};
</script>

<style lang="scss" scoped>
.detail {
  display: flex;
  color: #fff;

  .left {
    width: 200px;
    background-color: #262d47;
    height: 100%;

    .info-list {
      padding: 10px;

      .info-item {
        margin-bottom: 2px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        // background-color: #363657;
        color: #959fc5;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;

        &:hover {
          background-color: #1c2238 !important;
          color: #fff;
          cursor: pointer;
        }
      }

      .active {
        background-color: #1c2238 !important;
        color: #fff;
      }
    }
  }

  .right {
    flex: 1;
    background-color: #262d47;
    height: 100%;
    margin-left: 10px;
  }
}
</style>
